home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / lib / calc / nextprim.cal < prev    next >
Text File  |  1995-07-17  |  440b  |  24 lines

  1. /*
  2.  * Copyright (c) 1993 David I. Bell
  3.  * Permission is granted to use, distribute, or modify this source,
  4.  * provided that this copyright notice remains intact.
  5.  *
  6.  * Function to find the next prime (probably).
  7.  */
  8.  
  9. define nextprime(n, tries)
  10. {
  11.     if (isnull(tries))
  12.         tries = 20;
  13.     if (iseven(n))
  14.         n++;
  15.     while (ptest(n, tries) == 0)
  16.         n += 2;
  17.     return n;
  18. }
  19.  
  20. global lib_debug;
  21. if (lib_debug >= 0) {
  22.     print "nextprime(n, tries) defined";
  23. }
  24.